﻿
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;

using zijian666.Converts.Core;
using zijian666.Core.Abstractions;

namespace zijian666.Converts.Abstractions;

/// <summary>
/// 转换设置选项
/// </summary>
public interface IConvertSettings
{
    /// <summary>
    /// 翻译器
    /// </summary>
    IEnumerable<ITranslator>? Translators { get; }

    /// <summary>
    /// 字符串序列化程序
    /// </summary>
    IStringSerializer? StringSerializer { get; }
    /// <summary>
    /// 反射编译程序
    /// </summary>
    IReflectCompiler? ReflectCompiler { get; }
    /// <summary>
    /// 区域信息
    /// </summary>
    CultureInfo? CultureInfo { get; }
    /// <summary>
    /// 数字格式化信息
    /// </summary>
    NumberFormatInfo? NumberFormatInfo { get; }
    /// <summary>
    /// 中文编码
    /// </summary>
    Encoding? Encoding { get; }
    /// <summary>
    /// 获取转换器
    /// </summary>
    /// <typeparam name="T">输出转换后类型</typeparam>
    /// <param name="context">转换上下文</param>
    /// <returns></returns>
    IConvertor<T>? GetConvertor<T>(IConvertContext context);
    /// <summary>
    /// 获取在对象 <seealso cref="IFormattable.ToString(string, IFormatProvider)"/> 时使用的参数
    /// </summary>
    ToStringArgument? GetToStringArgument(Type type);
    /// <summary>
    /// 在字符串转集合,或集合转字符串时使用的分隔符
    /// </summary>
    StringSeparator? StringSeparator { get; }
    /// <summary>
    /// 在调用 <seealso cref="string.Split(string[], StringSplitOptions)"/> 时使用的参数
    /// </summary>
    StringSplitOptions StringSplitOptions { get; }
    /// <summary>
    /// 枚举转换是否使用严格模式
    /// </summary>
    /// <remarks>严格模式：如果值不在枚举的定义范围之内，则转换失败
    /// <br />宽松模式：值与枚举基础类型相同则可以转换</remarks>
    bool StrictEnum { get; }
}
